User equipment (UE) receives a system broadcast message sent by a base station, and the UE sends a random access message to the base station according to the system broadcast message, so that the UE and the base station establish a connection.
Currently, the UE determines, according to a formula P=min{PMAX, Pinitial value+(Npre−1)*ΔPrampup}, transmit power for sending the random access message, where P is the transmit power used for sending the random access message, PMAX is maximum transmit power, Pinitial value is initial transmit power, Npre is a quantity of times for sending the random access message in a process of a current round of a random access attempt, and ΔPrampup is an added value of transmit power for sending the random access message two consecutive times in the process of the current round of the random access attempt, Pinitial value is obtained by using Pinitial value=PL+Po_pre+Δpre, where PL is a downlink path loss, Po_pre is initial target receive power for a preamble code carried in the random access message, and Δpre is a format offset of the preamble code.
However, when the transmit power is directly determined according to the foregoing formula, in a case in which a downlink path loss is less than an uplink path loss, the transmit power determined according to the foregoing formula is less than transmit power that is actually required. Therefore, the random access message sent according to the determined transmit power cannot be sent to the base station, causing a relatively success rate of establishing the connection between the UE and the base station.